home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.04 Apr 95 / TreeAppƒ / Eric's C Libraries / ToolBoxTools.h < prev   
Encoding:
C/C++ Source or Header  |  1996-04-04  |  3.0 KB  |  94 lines  |  [TEXT/KAHL]

  1.  
  2. #pragma once
  3.  
  4. #include <StringTools.h>
  5.  
  6. /*=======================================================================*/
  7. /*= This file contains a set of utilities for doing nifty toolbox stuff =*/
  8. /*=======================================================================*/
  9.  
  10. #define        kEnter        3
  11. #define        kDelete        8
  12. #define        kTab        9
  13. #define        kReturn        13
  14. #define        kEscape        27
  15. #define        kLeftArrow    0x1C
  16. #define        kRightArrow    0x1D
  17. #define        kUpArrow    0x1E
  18. #define        kDownArrow    0x1F
  19.  
  20. #define        kLeft        100
  21. #define        kRight        101
  22. #define        kCenter        102
  23. #define        kTop        103
  24. #define        kBottom        104
  25. #define        kNone        105
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31.     pascal void saveThatA5()
  32.         = {0x2f0d, 0x2a68, 0xFFFC};
  33.         
  34.     pascal void restoreThatA5()
  35.         = {0x2a5f};
  36.  
  37.     Boolean  ButtonStillDownAfterN (long NumTicks);
  38.     /* return true if the button is still down after the specified # of ticks */
  39.  
  40.     StringPtr GetChooserName (StringPtr Default);
  41.     /* return the name which the chooser contains as the user name */
  42.     
  43.     Boolean CommandKeyDown (short modifierKeys);
  44.     /* return true if the command key is held down */
  45.  
  46.     Boolean    ShiftKeyDown (short modifierKeys);
  47.     /* return true if the shift key is held down */
  48.  
  49.     Boolean    OptionKeyDown (short modifierKeys);
  50.     /* return true if the option key is held down */
  51.  
  52.     Boolean    ControlKeyDown (short modifierKeys);
  53.     /* return true if the control key is held down */
  54.  
  55.     short isPressed(unsigned short k );
  56.     /* return ¬0 if the key whose code is k is pressed, 0 otherwise */ 
  57.  
  58.     short getModifiers (void);
  59.     /* get the states of all the modifier keys on the keyboard and return them */
  60.     /* in the format used in the 'modifier' field of an event record */
  61.  
  62.     void TimeString (long inDateTime, Boolean showAMPM, StringPtr DestString, short maxLen);
  63.     /* Given a Macintosh DateTime quantity, return a string of the format */
  64.     /* hr:mn:sec [A|P]M */
  65.     
  66.     void CurrentTimeString (Boolean showAMPM, StringPtr DestString, short maxLen);
  67.     /* Return a string of the format hr:mn:sec [A|P]M which represents the current time */    
  68.  
  69.     void ErrorAlert (short ErrorID, StringPtr Message);
  70.     /* Puts up a dialog which displays an error in one of the
  71.        following ways:
  72.        1) if there is an STR resource with the same ID as ErrorID, that
  73.              message is displayed along with the passed-in message
  74.        2) if there is no STR resource, the ErrorID and the passed-in
  75.           message are displayed.
  76.     */
  77.  
  78.     pascal void SetMenuItemText(MenuHandle theMenu,short item,StringPtr itemString);
  79.  
  80.     void CopyResource (short RFrom, short RTo, ResType itsType, short itsID);
  81.     /* copy the specified resource from the resource file specified by */
  82.     /* RFrom into the resource file specified by RTo */
  83.  
  84.     void CenterRect (Rect *Rect1, Rect *Rect2, Boolean Horiz, Boolean Vert);
  85.     /* center Rect1 inside Rect2 according to Horiz and Vert */
  86.     /* Rect1 is modified, Rect2 is not changed */
  87.  
  88.     void AlignRect (Rect *Rect1, Rect *Rect2, short HJust, short VJust);
  89.     /* justify Rect1 with respect to Rect2 according to the values of */
  90.     /* HJust (kLeft, kRight, kCenter) and VJust (kTop, kBottom, kCenter) */
  91.  
  92. #ifdef __cplusplus
  93. }
  94. #endif